#!/usr/bin/env python

import sys, os, os.path
import fontforge

def main():
    #mapear as ids...
    ids = {}
    with open(sys.argv[1]) as f:
        for line in f:
            key, val = line.strip().split()
            ids[key] = val
    for line in sys.stdin:
        broken = line.split('/')
        print ord(broken[-1][0]), ids[broken[-2].strip()], line.strip()
    

if __name__ == '__main__':
    sys.exit(main())
